using System;
using Altova.TypeInfo;
using Altova.Types;

namespace Altova.Xml
{
	public class XmlFormatter : ValueFormatter
	{
		public virtual string Format(Altova.Types.DateTime v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(Duration v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(long v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(ulong v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(double v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(string v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(byte[] v)
		{
			return Convert.ToBase64String(v);
		}

		public virtual string Format(bool v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual string Format(decimal v)
		{
			return CoreTypes.CastToString(v);
		}

		public virtual byte[] ParseBinary(string v)
		{
			return Convert.FromBase64String(v);
		}
	}
}
